<%@ page language="java"
         contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ page isELIgnored="false" %>
<!-- isELIgnored=true禁用EL表达式 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!-- JSTL格式化标签 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="${pageContext.request.contextPath}/js/jquery.min-2.1.1.js"></script>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/layui-v2.6.13/layui/css/index.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/layui-v2.6.13/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/layui-v2.6.13/layui/css/indexstyle.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/layui-v2.6.13/layui/layui.js"></script>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <script>
        if (window !== top)
            top.location.href = location.href;
    </script>
</head>
<body id="list-cont class= layui-bg-black">
<div class="site-nav-bg">
    <div class="site-nav w1200">
        <p class="sn-back-home">
            <i class="layui-icon layui-icon-home"></i>
            <a >首页</a>
        </p>
<%--        <p class="sn-back-home">--%>
<%--            <i class="layui-icon layui-icon-home"></i>--%>
<%--            <a href="${pageContext.request.contextPath}/admin/main">后台页面</a>--%>
<%--        </p>--%>
        <div class="sn-quick-menu">
            <c:if test="${sessionScope.u.id != null}">
                <div class="sp-cart"><i class="layui-icon layui-icon-form">
                </i><a style="margin-left: 5px" href="${pageContext.request.contextPath}/shop/goods/orderPage">我的订单</a>
                </div>
                <div class="sp-cart" style="margin-left: 15px"><i class="layui-icon layui-icon-cart-simple"></i>
                    <a style="margin-left: 5px" href="${pageContext.request.contextPath}/car/carPage">
                        购物车</a></div>
            </c:if>
            <c:if test="${sessionScope.u.id != null}">
                <div style="margin-left: 10px">
                    <a  href="${pageContext.request.contextPath}/user/userPage">
                        <div><i class="layui-icon layui-icon-user"></i>&nbsp;&nbsp;欢迎用户:<span>${sessionScope.u.uName}</span></div>
                    </a>
                </div>
            </c:if>

            <c:if test="${sessionScope.u.id == null}">
                <div>
                    <div class="login" style="margin-left: 15px"><i class="layui-icon layui-icon-user"></i><a
                            style="margin-left: 5px" href="${pageContext.request.contextPath}/page/shopping/login.jsp">登录</a></div>
                </div>
            </c:if>
        </div>
    </div>
</div>


<div class="header">
    <div class="headerLayout w1200">
        <div class="headerCon">
            <h1 class="mallLogo">
                <a title="商城">
                    <h4>B2C购物商城</h4>
                </a>
            </h1>
            <div class="mallSearch">
                <form class="layui-form" action="${pageContext.request.contextPath}/shop/goods/queryAllGoods" target="main">
                    <input type="text" name="gName" autocomplete="off" id="categoryName"
                           class="layui-input" placeholder="请输入商品名称">
                    <button class="layui-btn" type="submit">
                        <i class="layui-icon layui-icon-search"></i>
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="content">
    <div class="main-nav">
        <div class="inner-cont0">

            <div class="inner-cont1 w1200">
                <div class="inner-cont2">
                    <h4 style="margin-left: 30px">热门推荐</h4>
                    <iframe src="${pageContext.request.contextPath}/shop/goods/queryAllGoods" name="main" id="main" frameborder="0"
                            scrolling="no"
                            style="margin-left: 60px; width: 100%; height: 800px;">
                    </iframe>
                </div>
            </div>
            <div class="banner_y center">
                <div class="nav" style="background: #ffffff">
                    <div class="layui-panel">
                        <ul class="layui-menu">
                            <c:forEach items="${arr}" var="obj">
                                <!-- 间隔线 -->
<%--                                <li class="layui-menu-item-divider"></li>--%>
                                <li class="layui-menu-item-parent">
                                    <div class="layui-menu-body-title">
                                            ${obj.sName}
                                        <i class="layui-icon layui-icon-right"></i>
                                    </div>
                                    <div class="layui-panel layui-menu-body-panel">
                                        <ul>
                                            <c:forEach items="${obj.kidArr}" var="k">
                                                <li>
                                                    <div class="layui-menu-body-title" onclick="search(${k.id});">${k.sName}</div>
                                                </li>
                                            </c:forEach>
                                        </ul>
                                    </div>
                                </li>
                            </c:forEach>
                            <script>
                                function search(sId){
                                    var url = "${pageContext.request.contextPath}/shop/goods/queryAllGoods?sId="+sId
                                    console.info(url);
                                    //嵌入页面跳转
                                    main.location.href = url;
                                }
                            </script>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

</html>
